package com.type.TypingDetector;

import com.type.TypingDetector.AcceleromterUpdated.PREDICTION_TYPE;

public class LogElement {
	private static int GENID = 0;
	private int id;
	private String name;
	private long duration;
	private PREDICTION_TYPE type;
	private long startTime=0;
	private long endTime=0;
	
	public LogElement(String aName, long aDuration, PREDICTION_TYPE tpe) {
		id = GENID;
		GENID++;
		name=aName;
		duration=aDuration;
		type=tpe;
	}
	
	public LogElement(String aName, long aDuration) {
		id = GENID;
		GENID++;
		name=aName;
		duration=aDuration;
	}
	
	public void addDuration(long addedD) {
		duration += addedD;
	}
	
	public void setDuration(long nDur){
		duration = nDur;
	}
	
	public int getId() {
		return id;
	}
	
	public String getName() {
		return name;
	}
	
	public long getDuration () {
		return duration;
	}
	
	public PREDICTION_TYPE getType() {
		return type;
	}
	
	public long calcDuration(long alt) {
		if (endTime==0) {
			return (alt-startTime)/1000;
		}
		return (endTime-startTime)/1000;
	}
	
	public long getStartTime() {
		return startTime;
	}
	
	public long getEndTime() {
		return endTime;
	}
	
	public void setEndTime(long endTim) {
		endTime = endTim;
	}
	
	public void setStartTime(long startTim) {
		startTime = startTim;
	}
}
